package com.myapp;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.content.pm.PackageManager;
import java.util.*;
import android.content.Intent;
import android.speech.RecognizerIntent;

public class JNITest extends Activity {
    public native int plus (int x, int y);
    //public int plus (int x, int y){
    //return x+y;
    //}
    /** Called when the activity is first created. */
    @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            int x = plus(1, 2);
            android.util.Log.d("jni", String.valueOf(x));

            PackageManager pm = getPackageManager();
            List activities = pm.queryIntentActivities( new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
            if (activities.size() != 0) {
                System.out.println("I have speech");
            } else {
                System.out.println("I dont have speech");
            }

        }
    static { System.loadLibrary("jni"); }

    public String messageMe(String text) {
        System.out.println(text);
        TextView txtView = new TextView(this);
        txtView.setText(text);
        setContentView(txtView);
        return text;
    }
}
